import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home/index.vue'

const routes = [{
        path: '/',
        redirect: '/login',
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        meta: {
            istrun: true
        },
        children: [{
                path: '',
                redirect: '/home/focus'
            },
            {
                path: 'focus',
                component: () =>
                    import ('../views/Home/Focus/index.vue')
            },
            {
                path: 'found',
                component: () =>
                    import ('../views/Home/Found/index.vue')
            },
            {
                path: 'near',
                component: () =>
                    import ('../views/Home/Near/index.vue')
            }
        ]
    },
    {
        path: '/home/search',
        component: () =>
            import ('../views/Home/Search/index.vue'),
        meta: {
            istrun: false
        },
    },
    {
        path: '/home/detailinfo/:uid/:pid',
        component: () =>
            import ('../views/Home/DetailInfoBox/index.vue'),
        meta: {
            istrun: false
        },
    },
    {
        path: '/home/release',
        component: () =>
            import ('../views/Home/Release/index.vue'),
        meta: {
            istrun: false
        },
    },
    {
        path: '/hot',
        name: 'Mall',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mall/index.vue'),
        meta: {
            istrun: true
        },
    },
    {
        path: '/info',
        name: 'Info',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Info/index.vue'),
        meta: {
            istrun: true
        },
    },
    {
        path: '/mine',
        name: 'Mine',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/index.vue'),
        meta: {
            istrun: true
        },
    },
    {
        path: '/edit',
        name: 'Edit',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/edit.vue')
    },
    {
        path: '/fans/:uid',
        name: 'Fans',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/fans.vue')
    },
    {
        path: '/concern/:uid',
        name: 'Concern',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/concern.vue')
    },
    {
        path: '/homepage/:pid',
        name: 'Homepage',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/homepage.vue')
    },
    {
        path: '/service',
        name: 'Service',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/service.vue')
    },
    {
        path: '/login',
        name: 'Login',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/login.vue')
    },
    {
        path: '/register',
        name: 'Register',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Mine/register.vue')
    },
    {
        path: '/attention',
        name: 'Attention',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Info/attention.vue')
    },
    {
        path: '/praise',
        name: 'Praise',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Info/praise.vue')
    },


    {
        path: '/chat/:pid',
        name: 'Chat',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Info/chat.vue')
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router